package exer04;

/**
 * @author shkstart
 * @date 2022/5/4 - 13:07
 */
public class Bank {
    private Customer[] customers;
    private int numberOfCustomer;

    public Bank(){
        customers = new Customer[10];

    }

    public void addCustomer(String f,String l){
        Customer cust = new Customer(f,l);
        customers[numberOfCustomer] = cust;
        numberOfCustomer++;
//        System.out.println(cust); cust 打印出来的是地址
        //        customers[numberOfCustomer++] = cust; 也可合成一个

    }


    public int  getNumberOfCustomer(){
        return numberOfCustomer;
    }

    public Customer getCustomer(int index){
//        return customers[index]; 不合适 可能报异常
        if(index >= 0 && index < numberOfCustomer){
            return customers[index];
        }
        return null;

    }


}
